package com.ysx.day20210925.ch06;

import java.util.*;

public class Ch03 {

    public static void main(String[] args) {

        Map<Integer,Cat> map = new HashMap<Integer,Cat>();

        map.put(1010,new Cat(1010,"scott"));
        map.put(1020,new Cat(1020,"frank"));
        //System.out.println(map);

        Cat cat =map.get(1020);
        System.out.println(cat);

        //循环
        
        // KEY 1010 1020
        // VALUE

        // 15年
        Set<Integer> keySet = map.keySet();
        System.out.println(keySet);
        Iterator<Integer> iterator = keySet.iterator();
        while(iterator.hasNext()){
            int key =iterator.next();
            Cat value =map.get(key);
            System.out.println("key="+key);
            System.out.println("value="+value);
        }

        Collection<Cat> cats = map.values();

        System.out.println("-------------------------> 高");
        for(Cat entity:cats){
            System.out.println(entity);
        }



        /*for(int index=0;index<keySet.size();index++){
            keySet.
            System.out.println(cat);
        }*/



    }
}
